RawSourcePlus

RawSourcePlus

Loading raw video data from files

for Avisynth+ r2150 or greater
This filter is only for Avisynth+MT. Avisynth2.6 is not supported.

requirements

How to use

RawSourcePlus (string "file", int "width", int "height", string "pixel_type", int "fpsnum", int "fpsden", string "index", bool "show")

RawSourcePlus opens a video file which contains 8bit, 9bit, 10bit, 16bit or float YUV444, YUV422, YUV411, YUV420, Gray, or RGB video data.
There are three ways how the positions of the video frame data are calculated:

The default value of framerate is 25fps, you can change it with specified 'fpsnum' and 'fpsden' if you need (e.g. for NTSC-material).

With show=true the actually used byteposition for that frame is displayed, followed by:
 K = position given in index is used
 D = position by adding current delta is used
 B = position by adding currend big_delta is used

Some simple examples:

RawSourcePlus("d:\yuv4mpeg.y4m")  #this assumes there is a valid YUV4MPEG2-header inside.
                              #If not, default values are used: width=720, height=576, pixel_type="YUY2"

RawSourcePlus("d:\src6_625.raw",720,576,"BGRA") # really a raw file
      # if you are unsure about the pixel_type, simply try out all possible values.

Using an index-string:

You can enter the byte positions of the video frames directly.

RawSourcePlus("d:\yuv.mov",720,576,"UYVY", index="0:192512 1:1021952 25:21120512 50:42048512 75:62976512")

This is useful if it's not really raw video, but e.g. uncompressed MOV files or a file with some kind of header.
It will work whenever the spacing of the frames is fixed or has at least two fixed intervalls (e.g. audio data interleaved with the video every 25th frame).
You enter pairs of framenumber:byteposition.
Internally there are two step values (for the byte positions): delta and big_delta.
delta is stored everytime when two adjacent framenumbers are given, the default value is width*height*bytes_per_pixel.
big_delta is stored, when three framenumbers with the same two intervals are given. The default value is 0 (meaning there is no useful big_delta present)..
If those conditions are not met, the internal values of delta and big_delta is not updated, only the given bytepositions in the index are used.
big_delta is reset to 0 if the resulting position would be behind the given one (see beyond).

Here are some possible cases:

  0:    0
frame 0 starts at byte 0, step to frame 1 is default = width*height*bytes_per_pixel
  0:10000
frame 0 starts at 10000
  0: 5000
  1:15000
frame 0 at 5000
frame 1 at 15000 (delta is set to 10000)
frame 2 at 25000 (using delta)
frame 3 at 35000 (using delta)
  0:  5000
  1: 15000



25:290000 50:590000 75:890000
frame 0 at 5000
frame 1 at 15000 (delta=10000)
frame 2 at 25000
...
frame 25 at 290000 (using entry instead of delta which would be at 255000)
frame 26 at 300000 (still using delta)
...
frame 50 at 590000 (using entry instead of delta)
>> because 25...50 = 50...75 now big_delta is set to 300000 (590000-290000)
frame 51 at 600000 (still using delta)
...
frame 75 at 890000 (using entry which is the same as using big_delta)
... 
frame 100 at 1190000 (using big_delta)
frame 101 at 1200000 (using delta)
...
frame 125 at 1490000 (using big_delta)
  0:  5000
  1: 15000
 25:290000
 50:590000
 75:890000
100:950000
the same as in the previous example



frame 75 at 890000
>> because 890000+300000 > 950000 now big_delta is reset to 0.
frame 100 at 950000
frame 101 at 960000 (using delta)
...
frame 125 at 1200000 (there is NO big_delta)

The index string is treated as a filename, if there is an "." inside. The data is then read from that file, line breaks don't matter.

note:

This filter is automatically registerd as MT_SERIALIZED.
You don't have to set it yourself.

original author:Ernst Peché, 2005-10-13

modified by Oka Motofumi, 2011-06-14

Version 2016-07-07 - Modified RawSource26 to Avisynth+ plugin. Version 2016-08-14 - Update for Avisynth+ r2150 or later.